package ch11;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

class _10_HashSetEx {
	public static void main(String[] args) {
		Object[] objArr = { "1", 1, "2", "2", "3", "3", "4", "4", "4" };
		Set<Object> set = new HashSet<Object>();

		for (int i = 0; i < objArr.length; i++)	set.add(objArr[i]); 
		System.out.println(set); // [3, 2, 1, 1, 4]
		
		set = new LinkedHashSet<Object>();
		for (int i = 0; i < objArr.length; i++)	set.add(objArr[i]); 
		System.out.println(set); // [1, 1, 2, 3, 4]
	}
}